import torch
import torchvision
from torch import nn

input = torch.tensor([1,2,3],dtype=torch.float32)
taget = torch.tensor([1,2,5],dtype=torch.float32)

input = torch.reshape(input,(1,1,1,3))
taget = torch.reshape(taget,(1,1,1,3))

loss1 = nn.L1Loss(reduction="sum")
res = loss1(input,taget)
print(res)

mse_loss = nn.MSELoss()
res = mse_loss(input,taget)
print(res)

x = torch.tensor([0.1,0.2,0.3])
y = torch.tensor([1])
x = torch.reshape(x,(1,3))
loss_cross = nn.CrossEntropyLoss()
res = loss_cross(x,y)
print(res)